import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/emergency/emergency_department_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/double_control/get_user_by_id_entity.dart';


EmergencyDepartmentEntity $EmergencyDepartmentEntityFromJson(Map<String, dynamic> json) {
  final EmergencyDepartmentEntity emergencyDepartmentEntity = EmergencyDepartmentEntity();
  final String? businessId = jsonConvert.convert<String>(json['businessId']);
  if (businessId != null) {
    emergencyDepartmentEntity.businessId = businessId;
  }
  final List<EmergencyDepartmentEntity>? children = (json['children'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<EmergencyDepartmentEntity>(e) as EmergencyDepartmentEntity).toList();
  if (children != null) {
    emergencyDepartmentEntity.children = children;
  }
  final List<GetUserByIdEntity>? userList = (json['userList'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<GetUserByIdEntity>(e) as GetUserByIdEntity).toList();
  if (userList != null) {
    emergencyDepartmentEntity.userList = userList;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    emergencyDepartmentEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    emergencyDepartmentEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    emergencyDepartmentEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    emergencyDepartmentEntity.deleted = deleted;
  }
  final String? emergencyDescribe = jsonConvert.convert<String>(json['emergencyDescribe']);
  if (emergencyDescribe != null) {
    emergencyDepartmentEntity.emergencyDescribe = emergencyDescribe;
  }
  final String? function = jsonConvert.convert<String>(json['function']);
  if (function != null) {
    emergencyDepartmentEntity.function = function;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    emergencyDepartmentEntity.id = id;
  }
  final String? path = jsonConvert.convert<String>(json['path']);
  if (path != null) {
    emergencyDepartmentEntity.path = path;
  }
  final String? pid = jsonConvert.convert<String>(json['pid']);
  if (pid != null) {
    emergencyDepartmentEntity.pid = pid;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    emergencyDepartmentEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    emergencyDepartmentEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    emergencyDepartmentEntity.updateDate = updateDate;
  }
  final bool? isExpand = jsonConvert.convert<bool>(json['isExpand']);
  if (isExpand != null) {
    emergencyDepartmentEntity.isExpand = isExpand;
  }
  return emergencyDepartmentEntity;
}

Map<String, dynamic> $EmergencyDepartmentEntityToJson(EmergencyDepartmentEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['businessId'] = entity.businessId;
  data['children'] = entity.children.map((v) => v.toJson()).toList();
  data['userList'] = entity.userList.map((v) => v.toJson()).toList();
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['emergencyDescribe'] = entity.emergencyDescribe;
  data['function'] = entity.function;
  data['id'] = entity.id;
  data['path'] = entity.path;
  data['pid'] = entity.pid;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  data['isExpand'] = entity.isExpand;
  return data;
}

extension EmergencyDepartmentEntityExtension on EmergencyDepartmentEntity {
  EmergencyDepartmentEntity copyWith({
    String? businessId,
    List<EmergencyDepartmentEntity>? children,
    List<GetUserByIdEntity>? userList,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    String? emergencyDescribe,
    String? function,
    String? id,
    String? path,
    String? pid,
    String? updateBy,
    String? updateById,
    String? updateDate,
    bool? isExpand,
  }) {
    return EmergencyDepartmentEntity()
      ..businessId = businessId ?? this.businessId
      ..children = children ?? this.children
      ..userList = userList ?? this.userList
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..emergencyDescribe = emergencyDescribe ?? this.emergencyDescribe
      ..function = function ?? this.function
      ..id = id ?? this.id
      ..path = path ?? this.path
      ..pid = pid ?? this.pid
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate
      ..isExpand = isExpand ?? this.isExpand;
  }
}
